
import { defineStore } from 'pinia'
import { reqUserLogin } from '@/api/user'

let useUserStore = defineStore("user", {
  state() {
    return {
      userName: 1,
      token: ''

    }
  },
  //处理逻辑
  actions: {
    async userLogin(data: any) {
      //登录接口
      let {code,data:datas} = await reqUserLogin(data);
      if (code === 200) {
        this.userName = datas.userName
        this.token = datas.token
      }

    },
    getters: {

    }
  }
})


export default useUserStore
